home *** CD-ROM | disk | FTP | other *** search
-
- #pragma segment UTILS
-
- /*
- ** This source code was written by Tim Endres
- ** Email: time@ice.com.
- ** USMail: 8840 Main Street, Whitmore Lake, MI 48189
- **
- ** Some portions of this application utilize sources
- ** that are copyrighted by ICE Engineering, Inc., and
- ** ICE Engineering retains all rights to those sources.
- **
- ** Neither ICE Engineering, Inc., nor Tim Endres,
- ** warrants this source code for any reason, and neither
- ** party assumes any responsbility for the use of these
- ** sources, libraries, or applications. The user of these
- ** sources and binaries assumes all responsbilities for
- ** any resulting consequences.
- */
-
- #include "tickle.h"
-
-
- CreateDirectory()
- {
- SFReply myreply;
- Point mypoint;
- char folder_name[256];
- HVolumeParam vparm;
- WDPBRec wparm;
- HFileParam hparm;
-
- mypoint.h = mypoint.v = 75;
- strcpy(folder_name, "Untitled");
- c2pstr(folder_name);
- MyPutFile(mypoint, "\pNew Folder:", folder_name, NULL, &myreply);
- if (! myreply.good)
- return;
-
- vparm.ioCompletion = 0;
- vparm.ioNamePtr = NULL;
- vparm.ioVRefNum = myreply.vRefNum;
- vparm.ioVolIndex = 0;
- vparm.ioVSigWord = 0;
- PBHGetVInfo((HParmBlkPtr)&vparm, FALSE);
- if (vparm.ioVSigWord != 0x4244) {
- message_alert("Can not create directories on flat file system.");
- return;
- }
-
- wparm.ioCompletion = 0;
- wparm.ioNamePtr = NULL;
- wparm.ioVRefNum = myreply.vRefNum;
- wparm.ioWDIndex = 0;
- wparm.ioWDProcID = 0L;
- PBGetWDInfo(&wparm, false);
- if (wparm.ioResult != noErr) {
- message_alert("Error #%d getting directory info.", wparm.ioResult);
- return;
- }
-
- hparm.ioCompletion = 0;
- hparm.ioNamePtr = myreply.fName;
- hparm.ioVRefNum = myreply.vRefNum;
- hparm.ioDirID = wparm.ioWDDirID;
- PBDirCreate((HParmBlkPtr)&hparm, false);
- if (hparm.ioResult != noErr) {
- message_alert("Error #%d creating directory <%.*s>.",
- hparm.ioResult, myreply.fName[0], &myreply.fName[1]);
- }
- }
-
-